package c.h.a.j0;

import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout.LayoutParams;
import androidx.cardview.widget.CardView;
import c.h.a.f0.j;
import c.h.a.m0.i;
import c.h.b.a.a.c;
import com.liuzh.deviceinfo.DeviceInfoApp;
import com.liuzh.deviceinfo.card.CpuStatusCard;
import com.liuzh.deviceinfo.card.RamUsageCard;
import com.liuzh.deviceinfo.card.SensorAppCard;
import com.liuzh.deviceinfo.pro.ProActivity;
import java.util.concurrent.RejectedExecutionException;

/* compiled from: TabDashboard */
public class n0 extends h0 implements c.h.a.f0.j.a {
    public Handler W = new Handler();
    public RamUsageCard X;
    public CpuStatusCard Y;
    public Runnable Z = new a();
    public View b0;
    public SensorAppCard c0;

    /* compiled from: TabDashboard */
    public class a implements Runnable {
        public void run() {
            if (!n0.this.m0()) {
                RamUsageCard ramUsageCard = n0.this.X;
                if (ramUsageCard != null) {
                    ramUsageCard.e();
                }
                CpuStatusCard cpuStatusCard = n0.this.Y;
                if (cpuStatusCard != null) {
                    Runnable runnable = cpuStatusCard.G0;
                    Handler handler = c.h.a.m0.p.a.a;
                    try {
                        c.h.a.m0.p.a.c.execute(runnable);
                    } catch (RejectedExecutionException unused) {
                    }
                }
                n0.this.W.postDelayed(this, 1000);
            }
        }
    }

    /* compiled from: TabDashboard */
    public class b extends c.h.b.a.a.b {
        public void b() {
            c.f.a.a.a.a.z("ad_tab_dashboard");
        }

        public void c(String str) {
            n0 n0Var = n0.this;
            if (!n0Var.m0()) {
                ProActivity.G(n0Var.k());
                n0Var.t0();
            }
        }

        public void d(String str) {
            c.f.a.a.a.a.x("ad_tab_dashboard", str);
        }

        public void e(View view) {
            if (!n0.this.m0()) {
                CardView cardView = (CardView) n0.this.b0.findViewById(2131296331);
                i iVar = i.a;
                iVar = i.a;
                if (i.b()) {
                    n0.this.t0();
                    return;
                }
                cardView.setVisibility(0);
                cardView.removeAllViews();
                cardView.addView(view);
                LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
                layoutParams.gravity = 17;
                view.setLayoutParams(layoutParams);
            }
        }
    }

    public void E(Bundle bundle) {
        super.E(bundle);
        j.d.h(this);
    }

    public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        if (this.b0 == null) {
            this.b0 = layoutInflater.inflate(2131493052, viewGroup, false);
        }
        s0();
        return this.b0;
    }

    public void H() {
        this.E = true;
        j.d.j(this);
    }

    public void N() {
        this.E = true;
        this.W.removeCallbacks(this.Z);
    }

    public void P() {
        this.E = true;
        this.W.removeCallbacks(this.Z);
        this.Z.run();
        i iVar = i.a;
        iVar = i.a;
        if (i.b()) {
            t0();
        }
    }

    public void T(View view, Bundle bundle) {
        if (this.X == null) {
            this.X = (RamUsageCard) view.findViewById(2131296436);
        }
        if (this.Y == null) {
            this.Y = (CpuStatusCard) view.findViewById(2131296428);
        }
        if (this.c0 == null) {
            SensorAppCard sensorAppCard = (SensorAppCard) view.findViewById(2131296883);
            this.c0 = sensorAppCard;
            sensorAppCard.setSensorCardClick(new k(this));
            this.c0.setAppCardClick(new j(this));
        }
    }

    public void i(boolean z) {
        if (z) {
            t0();
        } else {
            s0();
        }
    }

    public String r0() {
        return DeviceInfoApp.c.getResources().getString(2131690434);
    }

    public final void s0() {
        i iVar = i.a;
        iVar = i.a;
        if (!i.b() && !c.f.a.a.a.a.u()) {
            c.f.a.a.a.a.y("ad_tab_dashboard");
            c.a(Z(), c.h.a.u.a.c, new b());
        }
    }

    public final void t0() {
        if (!m0()) {
            ViewGroup viewGroup = (ViewGroup) this.b0.findViewById(2131296331);
            viewGroup.removeAllViews();
            viewGroup.setVisibility(8);
        }
    }
}
